package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.repository.entity.Equipment;
import com.dragon.repository.entity.SchedulingSon;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EquipmentDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "设备名称")
    private String equipmentName;

    @ApiModelProperty(value = "设备编号")
    private String equipmentCode;

    @ApiModelProperty(value = "设备状态：0空闲1生产中")
    private Integer type;

    @ApiModelProperty(value = "图片")
    private String img;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "排产数量")
    private Integer schedulingNum;

    @ApiModelProperty(value = "预计完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date estimateFinishTime;

    @ApiModelProperty(value = "排产id")
    private Integer schedulingId;

    @ApiModelProperty(value = "排产的产品表")
    private List<Object> sonList;



    public EquipmentDTO() {}

    public EquipmentDTO(Equipment entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static EquipmentDTO convert(Equipment entity) {
        return new EquipmentDTO(entity);
    }

    public static List<EquipmentDTO> convertList(List<Equipment> list) {
        List<EquipmentDTO> resultList = new ArrayList<>();
        for (Equipment entity : list) {
            resultList.add(new EquipmentDTO(entity));
        }
        return resultList;
    }}
